<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <ui:composition template="layout.xhtml">
        <ui:define name="body">
            <h2>Nova Correição</h2>
            <h:form id="form" acceptcharset="utf-8" >
                <p:growl id="msg" life="3000"/>
                <p:panel styleClass="container_24 clearfix " style="background: none; border: none;">
                    <p class="subtitle">Dados Gerais</p>

                    <p:outputLabel value="Nome:" styleClass="grid_3"/>
                    <div class="grid_7">
                    <p:inputText value="#{managerCreateQuestionnaireResponse.questionnaireResponse.name}" />
                    </div>

                    <p:outputLabel value="Base legal:" styleClass="grid_3"/>
                    <p:inputText value="#{managerCreateQuestionnaireResponse.questionnaireResponse.grounds}" styleClass="grid_7"/>

                    <div class="clear"/>
                    <p:outputLabel value="Tipo:" styleClass="grid_3"/>
                    <div class="grid_7">
                        <p:selectOneMenu style="width:103%;" id="type" value="#{managerCreateQuestionnaireResponse.questionnaireResponse.type}" >
                            <f:selectItems var="item" itemLabel="#{item.toString()}" itemValue="#{item}"  value="#{managerCreateQuestionnaireResponse.types}" />  
                        </p:selectOneMenu>
                    </div>

                    <p:outputLabel value="Cartório:" styleClass="grid_3"/>
                    <div class="grid_7">
                        <p:autoComplete id="cartorio" value="#{managerCreateQuestionnaireResponse.notaryOffice}" 
                                        completeMethod="#{managerCreateNotaryOffice.completeNotary}"   
                                        var="c" itemLabel="#{c.nome}" itemValue="#{c}" 
                                        converter="notaryOfficeConverter" forceSelection="true" 
                                        minQueryLength="3" label="Cartorio"
                                        dropdown="true" required="true"  style="width:28%;" > 
                            <p:ajax event="itemSelect" listener="#{managerCreateQuestionnaireResponse.handleSelectNotary}" 
                                    process="@this"/> 
                        </p:autoComplete>
                    </div>
                    <div class="clear"/>

                    <p:outputLabel value="Executor:" styleClass="grid_3"/>
                    <div class="grid_7">
                        <p:autoComplete id="executor" value="#{managerCreateQuestionnaireResponse.executor}" 
                                        completeMethod="#{managerCreateExecutor.completeExecutor}"   
                                        var="e" itemLabel="#{e.name}" itemValue="#{e}" 
                                        converter="executorConverter" forceSelection="true" 
                                        minQueryLength="3" label="Executor"
                                        dropdown="true" required="true"  > 
                            <p:ajax event="itemSelect" listener="#{managerCreateQuestionnaireResponse.handleSelectExecutor}" 
                                    process="@this"/> 
                        </p:autoComplete>
                    </div>
                    <p:outputLabel value="Questionário:" styleClass="grid_3"/>
                    <div class="grid_7">
                        <p:autoComplete id="questionario" value="#{managerCreateQuestionnaireResponse.questionnaire}" 
                                        completeMethod="#{managerCreateQuestionnaire.completeQuestionnaire}"   
                                        var="q" itemLabel="#{q.titulo}" itemValue="#{q}" 
                                        converter="questionnaireConverter" forceSelection="true" 
                                        minQueryLength="3" label="Executor"
                                        dropdown="true" required="true"  > 
                            <p:ajax event="itemSelect" listener="#{managerCreateQuestionnaireResponse.handleSelectQuestionnaire}" 
                                    process="@this"/> 
                        </p:autoComplete>
                    </div>
                    <div class="clear"/>

                    <p:outputLabel value="Data :" styleClass="grid_3"/>
                    <div class="grid_7">
                        <p:calendar value="#{managerCreateQuestionnaireResponse.questionnaireResponse.dateQ}"
                                    showOn="button" autocomplete="true" />
                    </div>
                    <div class="clear"/>
                    <div class="buttonAction">
                        <p:commandButton value="Salvar" icon="ui-icon-disk" styleClass="ui-priority-primary"
                                         actionListener="#{managerCreateQuestionnaireResponse.save()}" update="msg, @form"/>
                        <p:commandButton value="Cancelar" icon="ui-icon-close" 
                                         actionListener="#{managerRedirect.redirect('eyre.xhtml')}" immediate="true"/>
                    </div>
                </p:panel>
            </h:form>
        </ui:define>
    </ui:composition>
</html>


